# 脚本速查表

## 目录

- [音频](#音频)
- [按钮](#按钮)
- [图片](#图片)
- [Megavox](#megavox_scripting)
- [粒子](#粒子)
- [多边形文本](#多边形文本)
- [文本输入](#文本输入)
- [YouTube / Twitch](#youtube-twitch)
- [音响](#音响)
- [NFT图片](#nft图片)
- [富文本](#富文本)
- [标志牌](#标志牌)
- [视频](#视频)
- [.VOX](#vox)
<hr>

(音频)=
## <img width='32' src='https://www.cryptovoxels.com/icons/audio.png' />   音频
### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以 `https://` 开头，并且必须以 `.mp3` 等音频扩展名结尾。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.mp3"})
```

##### 默认值

`""`

#### sprite
`布尔值`

##### 获取属性值

```js
feature.get('sprite')
// 返回：false
```

##### 设置属性值

```js
feature.set({'sprite': true})
```

##### 默认值

`false`

#### streaming
`布尔值`

##### 获取属性值

```js
feature.get('streaming')
// 返回：false
```

##### 设置属性值

```js
feature.set({'streaming': true})
```
##### 默认值

`false`

#### autoplay
`布尔值`

##### 获取属性值

```js
feature.get('autoplay')
// 返回：false
```

##### 设置属性值

```js
feature.set({'autoplay': true})
```
##### 默认值

`false`

#### loop
`布尔值`

##### 获取属性值

```js
feature.get('loop')
// 返回：false
```

##### 设置属性值

```js
feature.set({'loop': true})
```

##### 默认值

`false`

#### rolloffFactor
`浮点数`；值范围从0到5

##### 获取属性值

```js
feature.get('rolloffFactor')
// 返回：1.6
```

##### 设置属性值

```js
feature.set({'rolloffFactor': 1.6})
```

##### 默认值

`1.6`

#### volume
`浮点数`；值范围从0到1

##### 获取属性值

```js
feature.get('volume')
// 返回：0.5
```

##### 设置属性值

```js
feature.set({'volume': 0.5})
```

##### 默认值

`0.5`

#### type
`字符串`

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："audio"
```

### 脚本方法
### 脚本方法 {.tabset}
#### play()
```js
feature.play()
```
播放音频

#### pause()
```js
feature.pause()
```
暂停音频

(按钮)=
## <img width='32' src='https://www.cryptovoxels.com/icons/button.png' /> 按钮


### 脚本属性
### 脚本属性 {.tabset}
#### color
`字符串`；选项为'white'、'red'、'green'和'blue'。

##### 获取属性值

```js
feature.get('color')
// 返回："red"
```

##### 设置属性值

```js
feature.set({'color': "blue"})
```

##### 默认值

`"red"`

#### soundId
`整数`；可以是0到14范围内的整数。

`'-1'` - 无
`'0'` - 叮咚
`'1'` - 乒乓
`'2'` - pshlick - 听起来像液压触发器
`'3'` - breet - 听起来像PC试图连接互联网
`'4'` - claclack - 听起来像有人在键盘上连续按键
`'5'` - tpow Cling - 听起来像球击中球拍，然后击中金属杆
`'6'` - traarz - 听起来像打印机
`'7'` - wuwuwuwu - 听起来像UFO
`'8'` - flickfli - 听起来像有人翻阅纸张
`'9'` - pshing dong - 听起来像钹和叮咚
`'10'` - bzing - 听起来像一个快速的嗡嗡声（真的）
`'11'` - tadaw - 听起来像小丑的声音
`'12'` - shplow - 听起来像PVC管被击中
`'13'` - tshlshlsh - 听起来像一个笔记计数器
`'14'` - miaaaaaa - 听起来像有人骚扰一只猫
`'15'` - miaoowww - 听起来像一只饥饿的猫

##### 获取属性值

```js
feature.get('soundId')
// 返回："0"
```

##### 设置属性值

```js
feature.set({'soundId': "-1"})
//请记住soundId必须是字符串类型
```

##### 默认值

`"0"`

#### type
`字符串`；

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type
// 返回："button"
```

#### 如何使用
通过脚本字段，您可以监听点击事件：

```js
feature.on('click', e => {
// 在此处执行点击时的操作
})
```

您还可以通过以下方式知道谁点击了按钮：

```js
feature.on('click', e => {
console.log(e.player)
})
```

(图片)=
## <img width='32' src='https://www.cryptovoxels.com/icons/image.png' /> 图片


### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以 `https://` 开头，并且必须以 `.jpg/.gif/.png` 等扩展名结尾。

##### 获取属性值

```js
feature.get('url')
//

return: "https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.png"})
```

##### 默认值

`""`

#### link
`字符串`；链接必须以`https://`开头。

##### 获取属性值

```js
feature.get('link')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'link': "https://www.myurl.com/"})
```

##### 默认值

`""`


#### blendMode
`字符串`

##### 获取属性值

```js
feature.get('blendMode')
// 返回："Combine"
```

##### 设置属性值

```js
feature.set({'blendMode': 'Combine'})
```

##### 默认值

`"Multiply"`

#### updateDaily
`布尔值`

##### 获取属性值

```js
feature.get('updateDaily')
// 返回：false
```

##### 设置属性值

```js
feature.set({'updateDaily': true})
```

##### 默认值

`false`

#### transparent
`布尔值`

##### 获取属性值

```js
feature.get('transparent')
// 返回：false
```

##### 设置属性值

```js
feature.set({'transparent': true})
```

##### 默认值

`false`

#### stretched
`布尔值`

##### 获取属性值

```js
feature.get('stretched')
// 返回：false
```

##### 设置属性值

```js
feature.set({'stretched': true})
```

##### 默认值

`false`


#### uScale
`整数`

##### 获取属性值

```js
feature.get('uScale')
// 返回：1
```

##### 设置属性值

```js
feature.set({'uScale': 1})
```

##### 默认值

`1`

#### vScale
`整数`

##### 获取属性值

```js
feature.get('vScale')
// 返回：1
```

##### 设置属性值

```js
feature.set({'vScale': 1})
```

##### 默认值

`1`

#### type
`字符串`；

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："image"
```


(megavox_scripting)=
## <img width='32' src='https://www.cryptovoxels.com/icons/megavox.png' /> Megavox


### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头，并且必须以`.vox`等vox模型扩展名结尾。
必须链接到一个126x126x126的vox模型。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.vox"})
```

##### 默认值

`""`

#### link
`字符串`；链接必须以`https://`开头。

##### 获取属性值

```js
feature.get('link')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'link': "https://www.myurl.com/"})
```

##### 默认值

`""`

#### collidable
`布尔值`

##### 获取属性值

```js
feature.get('collidable')
// 返回：false
```

##### 设置属性值

```js
feature.set({'collidable': true})
```

##### 默认值

`false`

#### type
`字符串`；

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："megavox"
```

(粒子)=
## <img width='32' src='https://www.cryptovoxels.com/icons/particle.png'/> 粒子


### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头，并且必须以`.jpg/.gif/.png`等扩展名结尾。
> 如果您设置了URL，则自定义颜色color1和color2将被忽略。
{.is-info}

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.png"})
```

##### 默认值

`""`

#### emitRate
`双精度`；必须是0到100之间的数字。

##### 获取属性值

```js
feature.get('emitRate')
// 返回：50.0
```

##### 设置属性值

```js
feature.set({'emitRate': 52})
```

##### 默认值

`50`


#### minSize
`双精度`；必须是0到1之间的数字。

##### 获取属性值

```js
feature.get('minSize')
// 返回：0.5
```

##### 设置属性值

```js
feature.set({'minSize': 0.5})
```

##### 默认值

`0.5`


#### maxSize
`双精度`；必须是0到1之间的数字。

##### 获取属性值

```js
feature.get('maxSize')
// 返回：0.5
```

##### 设置属性值

```js
feature.set({'maxSize': 0.5})
```

##### 默认值

`0.5`

#### color1
`字符串` - 十六进制； 

##### 获取属性值

```js
feature.get('color1')
// 返回："#4cb844"
```

##### 设置属性值

```js
feature.set({'color1': "#4cb844"})
```

##### 默认值

`#000000`

#### color2
`字符串` - 十六进制； 

##### 获取属性值

```js
feature.get('color2')
// 返回："#4cb888"
```

##### 设置属性值

```js
feature.set({'color2': "#4cb844"})
```

##### 默认值

`"#000000"`


#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："particles"
```




(多边形文本)=
## <img width='32' src='//www.cryptovoxels.com/icons/polytext.png' /> 多边形文本

### 脚本属性
### 脚本属性 {.tabset}
#### text
`字符串`； 

##### 获取属性值

```js
feature.get('text')
// 返回："My new text"
```

##### 设置属性值

```js
feature.set({'text': "My new text"})
```

##### 默认值

`""`
#### edges
`布尔值`

##### 获取属性值

```js
feature.get('edges')
// 返回：false
```

##### 设置属性值

```js
feature.set({'edges': true})
```

##### 默认值

`false`

#### type
`字符串`； 

##### 获取属性值

```js
feature

.get('type')
/* 或 */
feature.type
// 返回："polytext"
```


(文本输入)=
## <img width='32' src='//www.cryptovoxels.com/icons/text-input.png' /> 文本输入

### 脚本属性
### 脚本属性 {.tabset}
#### text
`字符串`； 

##### 获取属性值

```js
feature.get('text')
// 返回："my text"
```

##### 设置属性值

```js
feature.set({'text': "my text"})
```

##### 默认值

`""`

#### placeholder
`字符串`； 

##### 获取属性值

```js
feature.get('placeholder')
// 返回："my text"
```

##### 设置属性值

```js
feature.set({'placeholder': "my text"})
```

##### 默认值

`"placeholder"`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："text-input"
```


(youtube-twitch)=
## <img width='16' src='//www.cryptovoxels.com/icons/youtube.png' /> YouTube / Twitch

### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头，并且必须是`youtube, twitch, soundcloud, spotify`之一。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.youtube.com/?v=..."})
```

##### 默认值

`""`

#### previewUrl
`字符串`；链接必须以`https://`开头，并且必须是`.png,.gif,jpg`之一。

##### 获取属性值

```js
feature.get('previewUrl')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'previewUrl': "https://..."})
```

##### 默认值

`""`

#### screenRatio
`字符串`；链接必须以`https://`开头，并且必须是`.png,.gif,jpg`之一。

##### 获取属性值

```js
feature.get('screenRatio')
// 返回："43"
```

##### 设置属性值

```js
feature.set({'screenRatio': "169"})
```

##### 默认值

`"169"`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："youtube"
```

### 脚本方法
### 脚本方法 {.tabset}

#### play()

```js
feature.play()
```
播放视频

#### 暂停
```js
feature.pause()
```
暂停视频


(音响)=
## <img width='32' src='//www.cryptovoxels.com/icons/boombox.png' /> 音乐盒

### 脚本属性
### 脚本属性 {.tabset}
#### rollOffFactor
`双精度`；取值范围为0到5

##### 获取属性值

```js
feature.get('rolloffFactor')
// 返回：1.6
```

##### 设置属性值

```js
feature.set({'rolloffFactor': 1.6})
```

##### 默认值

`1`

(nft图片)=
## <img width='32' src='//www.cryptovoxels.com/icons/nft-image.png'/> NFT 图像
### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.opensea.io/"})
```

##### 默认值

`""`

#### stretch
`布尔值`; 

##### 获取属性值

```js
feature.get('stretch')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'stretch': true})
```

##### 默认值

`false`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："nft-image"
```

(富文本)=
## <img width='32' src='//www.cryptovoxels.com/icons/richtext.png' /> 富文本

### 脚本属性
### 脚本属性 {.tabset}
#### text
`字符串`; 

##### 获取属性值

```js
feature.get('text')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'text': "my paragraph"})
```

##### 默认值

`""`
#### blendMode
`字符串`

##### 获取属性值

```js
feature.get('blendMode')
// 返回："Combine"
```

##### 设置属性值

```js
feature.set({'blendMode': 'Combine'})
```

##### 默认值

`"Multiply"`

#### inverted
`布尔值`; 

##### 获取属性值

```js
feature.get('inverted')
// 返回：false
```

##### 设置属性值

```js
feature.set({'inverted': true})
```

##### 默认值

`false`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："richtext"
```



(标志牌)=
## <img width='32' src='//www.cryptovoxels.com/icons/sign.png' /> 招牌
### 脚本属性
### 脚本属性 {.tabset}
#### text
`字符串`; 

##### 获取属性值

```js
feature.get('text')
// 返回："my line of text"
```

##### 设置属性值

```js
feature.set({'text': "my line of text"})
```

##### 默认值

`""`

#### link
`字符串`; 

##### 获取属性值

```js
feature.get('link')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'link': "https://..."})
```

##### 默认值

`""`

#### fontSize
`整数`; 

##### 获取属性值

```js
feature.get('fontSize')
// 返回：25
```

##### 设置属性值

```js
feature.set({'fontSize': 25})
```

##### 默认值

`25`

#### color
`字符串`-十六进制； 

##### 获取属性值

```js
feature.get('color')
// 返回："#00000"
```

##### 设置属性值

```js
feature.set({'color': "#fcba03"})
```

##### 默认值

`"#00000"`

#### background
`字符串`-十六进制； 

##### 获取属性值

```js
feature.get('background')
// 返回："#00000"
```

##### 设置属性值

```js
feature.set({'background': "#fcba03"})
```

##### 默认值

`"#fffff"`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

//

 return: "sign"
```

(视频)=
## <img width='32' src='//www.cryptovoxels.com/icons/video.png' /> 视频
### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头，并且必须以`.mp4`等视频扩展名结尾。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.mp4"})
```

##### 默认值

`""`

#### loop
`布尔值`

##### 获取属性值

```js
feature.get('loop')
// 返回：false
```

##### 设置属性值

```js
feature.set({'loop': true})
```

##### 默认值

`false`

#### type
`字符串`;

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："video"
```

(vox)=
## <img width='32' src='//www.cryptovoxels.com/icons/vox.png' /> .VOX
### 脚本属性
### 脚本属性 {.tabset}
#### url
`字符串`；链接必须以`https://`开头，并且必须以`.vox`等vox模型扩展名结尾。
必须链接到一个126x126x126的vox模型。

##### 获取属性值

```js
feature.get('url')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'url': "https://www.myurl.com/file.vox"})
```

##### 默认值

`""`

#### link
`字符串`；链接必须以`https://`开头。

##### 获取属性值

```js
feature.get('link')
// 返回："https://..."
```

##### 设置属性值

```js
feature.set({'link': "https://www.myurl.com/"})
```

##### 默认值

`""`

#### collidable
`布尔值`

##### 获取属性值

```js
feature.get('collidable')
// 返回：false
```

##### 设置属性值

```js
feature.set({'collidable': true})
```

##### 默认值

`false`

#### type
`字符串`；

##### 获取属性值

```js
feature.get('type')
/* 或 */
feature.type

// 返回："vox"
```